import Vue from "vue"

Vue.filter("rolename", (value) => {
    if (!value) return value;
    switch (value) {
        case "1":
            return "普通居民"
            break;
        case "2":
            return "会员用户"
            break;
        case "3":
            return "管理员"
            break;
        case "4":
            return "超级管理员"
            break;
        default:
            return "未知"
            break;

    }
})

Vue.filter("colortype", (value) => {
    if (!value) return value;
    switch (value) {
        case "1":
            return "success"
            break;
        case "2":
            return "warning"
            break;
        case "3":
            return "primary"
            break;
        case "4":
            return "danger"
            break;
        default:
            return ""
            break;
    }
 })

 import moment from "moment"

 Vue.filter("timeFormat",(value,format)=>{
     if(!value)return value;
     format = format || "MM-DD HH:mm:ss"
     return moment(value).format(format)
 })